import { createBrowserRouter, Navigate } from 'react-router-dom'
import Home from '@/views/home'
import Error404 from '@/views/404'
import Error403 from '@/views/403'
import Login from '@/views/login/index'
import Layout from '@/layout/index'
import Image from '@/views/image'
import Notice from '@/views/notice'
import Comment from '@/views/comment'
import Order from '@/views/order'
import Role from '@/views/role'
import Access from '@/views/access'
import Manager from '@/views/manager'
import Level from '@/views/level'
import User from '@/views/user'
import Coupon from '@/views/coupon'
import Skus from '@/views/skus'
import Category from '@/views/category'
const routers = [
  {
    path: '/login',
    element: <Login />
  },
  {
    path: '/',
    element: <Layout />,
    children: [
      {
        path: '/',
        element: <Home />
      },
      {
        path: '/image/list',
        element: <Image />
      },
      {
        path: '/notice/list',
        element: <Notice />
      },
      {
        path: '/comment/list',
        element: <Comment />
      },
      {
        path: '/order/list',
        element: <Order />
      },
      {
        path: '/role/list',
        element: <Role />
      },
      {
        path: '/access/list',
        element: <Access />
      },
      {
        path: '/manager/list',
        element: <Manager />
      },
      {
        path: '/level/list',
        element: <Level />
      },
      {
        path: '/user/list',
        element: <User />
      },
      {
        path: '/coupon/list',
        element: <Coupon />
      },
      {
        path: '/skus/list',
        element: <Skus />
      },
      {
        path: '/category/list',
        element: <Category />
      }
    ]
  },
  {
    path: '*',
    element: <Navigate to='/404' />
  },
  {
    path: '/403',
    element: <Error403 />
  },
  {
    path: '/404',
    element: <Error404 />
  }
]

export default createBrowserRouter(routers)
